<?php


namespace app\backend\validate;


use think\Validate;

class QuestionValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'grade_id' => 'require',
        'course_id' => 'require',
        'paper_id' => 'require',
        'title' => 'require',
        'content' => 'require',
        'answer' => 'require',
        'desc' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'grade_id.require' => '请输入年级名称！',
        'course_id.require' => '请输入课程名称！',
        'paper_id.require' => '请输入试卷名称！',
        'title.require' => '请输入题目名称！',
        'content.require' => '请输入选项内容！',
        'answer.require' => '请输入答案！',
        'desc.require' => '请输入中文！',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['grade_id', 'course_id','paper_id', 'title',  'content', 'answer', 'desc'],
        'update' => ['grade_id', 'course_id','paper_id', 'title',  'content', 'answer', 'desc'],
    ];
}